package com.indusfo.spc.mapper;

import com.indusfo.spc.pojo.MaintainPlan;
import com.indusfo.spc.pojo.MaintainPlanDetail;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface MaintainPlanDetailMapper {
    int deleteByPrimaryKey(Integer maintainPlanDetailId);

    int insert(MaintainPlanDetail record);

    int insertSelective(MaintainPlanDetail record);

    MaintainPlanDetail selectByPrimaryKey(Integer maintainPlanDetailId);

    int updateByPrimaryKeySelective(MaintainPlanDetail record);

    int updateByPrimaryKey(MaintainPlanDetail record);

    /**
     * 根据保养计划ID,设备ID,保养项目id数组来新增明细
     * @param maintainPlanId
     * @param maintainIds
     * @return
     */
    int updateMaintainPlanDetailList(@Param("maintainPlanId") Integer maintainPlanId,@Param("maintainIds") Integer[] maintainIds);

    /**
     * 查询设备保养明细通过
     * @param maintainPlanDetail
     * @return
     */
    List<MaintainPlanDetail> queryMaintainPlanDetail(MaintainPlanDetail maintainPlanDetail);

    /**
     * 计数设备保养明细
     * @param maintainPlanDetail
     * @return
     */
    int countMaintainPlanDetail(MaintainPlanDetail maintainPlanDetail);
    /**
     * 通过设备保养计划的id获取到设备保养计划明细表里所属的所有的保养项目id
     * @param deviceId
     * @return
     */
    List<Integer> queryByDeviceId(@Param("deviceId") Integer deviceId);

    /**
     * 删除设备保养计划明细
     * @param maintainPlanId
     * @param maintainIds
     * @param dataState
     * @return
     */
    int defineMaintainPlanDetail(@Param("maintainPlanId") Integer maintainPlanId,@Param("maintainIds")Integer[] maintainIds,@Param("dataState") Integer dataState);

    /**
     * 通过设备保养计划id查取明细id保养项目id
     * @param maintainPlanId
     * @return
     */
    List<Integer> queryByMaintainPlan(@Param("maintainPlanId") Integer maintainPlanId);

    /**
     * 删除设备保养计划下的明细
     * @param maintainPlanIds
     * @param dataState
     * @return
     */
    int defineByMaintainPlanIds(@Param("maintainPlanIds") Integer[] maintainPlanIds,@Param("dataState") Integer dataState);
    // 根据保养ID查询
    int selectByMaintainId(@Param("maintainIds")Long[] maintainIds);
}